package com.zui.util;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.displaytag.pagination.PaginatedList;
import org.displaytag.properties.SortOrderEnum;

/**
 * external paging for display tag.
 * 
 * @author zhaoyong
 */
public class PaginatedListImpl extends ArrayList<Object> implements PaginatedList,Serializable {
	private static final long serialVersionUID = 6419151648208081939L;

	//TODO: 自从接触jqGrid,已经抛弃DisplayTag了,那这个类何去何从呢?
	public static final String DEFAULT_SORT_CRITERION = "id";

	public PaginatedListImpl() {
		this.sortCriterion = DEFAULT_SORT_CRITERION;
		this.sortDirection = SortOrderEnum.ASCENDING;
	}

	public List<?> getList() {
			return this;
	}
	/**
	 * total records number, the same as "records" in jqGrid
	 */
	private int fullListSize;
	public void setfullListSize(int fullListSize) {	this.fullListSize = fullListSize;}
	public int getFullListSize() {return fullListSize;}

	private int objectsPerPage = Page.PAGE_SIZE;
	public int getObjectsPerPage() {return objectsPerPage;}
	public void setObjectsPerPage(int pageSize) {this.objectsPerPage = pageSize;}

	/**
	 * currently requested page number, the same as "page"
	 */
	private int pageNumber;
	public int getPageNumber() {return pageNumber;}
	public void setPageNumber(int pageNumber) {this.pageNumber = pageNumber;}

	private String sortCriterion;
	public String getSortCriterion() {return sortCriterion;}
	public void setSortCriterion(String sortCriterion) {this.sortCriterion = sortCriterion;}

	private SortOrderEnum sortDirection;
	public SortOrderEnum getSortDirection() {return sortDirection;}
	public void setSortDirection(SortOrderEnum sortDirection) {this.sortDirection = sortDirection;}

	@Override
	public String getSearchId() {
		// TODO Auto-generated method stub
		return null;
	}
}